﻿
/*----------------------------------------------------------------//
// 文件名：MoContract.cs
// 文件功能描述：实体 MoContract.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoContract
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoContract
    /// </summary>
    public partial class MoContract : ICloneable
    {
        #region 表Contract的字段
        private string reportId;
        private string uid;
        private string clientId;
        private string corpName;
        private string consigner;
        private string linkman;
        private string tel;
        private string phone;
        private string fax;
        private string addr;
        private string postcode;
        private string email;
        private decimal charge;
        private int reportStatus;
        private string reportUrl;
        private decimal totalPrice;
        private DateTime createTime;
        private DateTime updateTime;
        #endregion

        #region 构造函数
        public MoContract()
        {
            createTime = new DateTime(1900, 1, 1); updateTime = new DateTime(1900, 1, 1);

        }
        #endregion

        #region 拷贝构造函数

        public MoContract(MoContract item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoContract(string reportId, string uid, string clientId, string corpName, string consigner, string linkman, string tel, string phone, string fax, string addr, string postcode, string email, decimal charge, int reportStatus, string reportUrl, decimal totalPrice, DateTime createTime, DateTime updateTime)
        {
            this.reportId = reportId;
            this.uid = uid;
            this.clientId = clientId;
            this.corpName = corpName;
            this.consigner = consigner;
            this.linkman = linkman;
            this.tel = tel;
            this.phone = phone;
            this.fax = fax;
            this.addr = addr;
            this.postcode = postcode;
            this.email = email;
            this.charge = charge;
            this.reportStatus = reportStatus;
            this.reportUrl = reportUrl;
            this.totalPrice = totalPrice;
            this.createTime = createTime;
            this.updateTime = updateTime;
        }
        #endregion

        #region 表Contract的字段属性
        /// <summary>
        ///编号规则为NO. LDYYMMXXX，其中NO.LD为固定前缀，YY表示年份，MM代表月份，XXX代表当月第几个报告。XXX为业务组手工录入。此编号不能重复。报告编号做为唯一值编号贯穿于整个系统流程（包括财务、业务、试验、报告等各部门）
        /// </summary>
        public string ReportId
        {
            get { return reportId; }
            set { reportId = value; }
        }
        /// <summary>
        /// UID
        /// </summary>
        public string Uid
        {
            get { return uid; }
            set { uid = value; }
        }
        /// <summary>
        ///客户ID应符合一定的规则。
        /// </summary>
        public string ClientId
        {
            get { return clientId; }
            set { clientId = value; }
        }
        /// <summary>
        /// CORP_NAME
        /// </summary>
        public string CorpName
        {
            get { return corpName; }
            set { corpName = value; }
        }
        /// <summary>
        /// CONSIGNER
        /// </summary>
        public string Consigner
        {
            get { return consigner; }
            set { consigner = value; }
        }
        /// <summary>
        /// LINKMAN
        /// </summary>
        public string Linkman
        {
            get { return linkman; }
            set { linkman = value; }
        }
        /// <summary>
        /// TEL
        /// </summary>
        public string Tel
        {
            get { return tel; }
            set { tel = value; }
        }
        /// <summary>
        /// PHONE
        /// </summary>
        public string Phone
        {
            get { return phone; }
            set { phone = value; }
        }
        /// <summary>
        /// FAX
        /// </summary>
        public string Fax
        {
            get { return fax; }
            set { fax = value; }
        }
        /// <summary>
        /// ADDR
        /// </summary>
        public string Addr
        {
            get { return addr; }
            set { addr = value; }
        }
        /// <summary>
        /// POSTCODE
        /// </summary>
        public string Postcode
        {
            get { return postcode; }
            set { postcode = value; }
        }
        /// <summary>
        /// EMAIL
        /// </summary>
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        /// <summary>
        ///实际缴纳的费用。一般这个值是小于PRICE（价格）的，因为有打折。
        /// </summary>
        public decimal Charge
        {
            get { return charge; }
            set { charge = value; }
        }
        /// <summary>
        ///状态符合工作流标准。
        /// </summary>
        public int ReportStatus
        {
            get { return reportStatus; }
            set { reportStatus = value; }
        }
        /// <summary>
        /// REPORT_URL
        /// </summary>
        public string ReportUrl
        {
            get { return reportUrl; }
            set { reportUrl = value; }
        }
        /// <summary>
        /// TOTAL_PRICE
        /// </summary>
        public decimal TotalPrice
        {
            get { return totalPrice; }
            set { totalPrice = value; }
        }
        /// <summary>
        /// CREATE_TIME
        /// </summary>
        public DateTime CreateTime
        {
            get { return createTime; }
            set { createTime = value; }
        }
        /// <summary>
        /// UPDATE_TIME
        /// </summary>
        public DateTime UpdateTime
        {
            get { return updateTime; }
            set { updateTime = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoContract CopyTo(MoContract item)
        {
            item.reportId = this.reportId;
            item.uid = this.uid;
            item.clientId = this.clientId;
            item.corpName = this.corpName;
            item.consigner = this.consigner;
            item.linkman = this.linkman;
            item.tel = this.tel;
            item.phone = this.phone;
            item.fax = this.fax;
            item.addr = this.addr;
            item.postcode = this.postcode;
            item.email = this.email;
            item.charge = this.charge;
            item.reportStatus = this.reportStatus;
            item.reportUrl = this.reportUrl;
            item.totalPrice = this.totalPrice;
            item.createTime = this.createTime;
            item.updateTime = this.updateTime;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoContract mo = new MoContract();
            mo.ReportId = this.ReportId;
            mo.Uid = this.Uid;
            mo.ClientId = this.ClientId;
            mo.CorpName = this.CorpName;
            mo.Consigner = this.Consigner;
            mo.Linkman = this.Linkman;
            mo.Tel = this.Tel;
            mo.Phone = this.Phone;
            mo.Fax = this.Fax;
            mo.Addr = this.Addr;
            mo.Postcode = this.Postcode;
            mo.Email = this.Email;
            mo.Charge = this.Charge;
            mo.ReportStatus = this.ReportStatus;
            mo.ReportUrl = this.ReportUrl;
            mo.TotalPrice = this.TotalPrice;
            mo.CreateTime = this.CreateTime;
            mo.UpdateTime = this.UpdateTime;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoContract NewContract = obj as MoContract;
                if (NewContract == null)
                {
                    return false;
                }
                else
                {
                    if (NewContract.ReportId == this.ReportId && NewContract.Uid == this.Uid && NewContract.ClientId == this.ClientId && NewContract.CorpName == this.CorpName && NewContract.Consigner == this.Consigner && NewContract.Linkman == this.Linkman && NewContract.Tel == this.Tel && NewContract.Phone == this.Phone && NewContract.Fax == this.Fax && NewContract.Addr == this.Addr && NewContract.Postcode == this.Postcode && NewContract.Email == this.Email && NewContract.Charge == this.Charge && NewContract.ReportStatus == this.ReportStatus && NewContract.ReportUrl == this.ReportUrl && NewContract.TotalPrice == this.TotalPrice && NewContract.CreateTime == this.CreateTime && NewContract.UpdateTime == this.UpdateTime)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "ReportId={0}/Uid={1}/ClientId={2}/CorpName={3}/Consigner={4}/Linkman={5}/Tel={6}/Phone={7}/Fax={8}/Addr={9}/Postcode={10}/Email={11}/Charge={12}/ReportStatus={13}/ReportUrl={14}/TotalPrice={15}/CreateTime={16}/UpdateTime={17}", reportId, uid, clientId, corpName, consigner, linkman, tel, phone, fax, addr, postcode, email, charge, reportStatus, reportUrl, totalPrice, createTime, updateTime);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Report_ID"] != null && row["Report_ID"] != DBNull.Value)
            {
                this.ReportId = (string)row["Report_ID"];
            }
            else
            {
                this.ReportId = string.Empty;
            }
            if (row["UID"] != null && row["UID"] != DBNull.Value)
            {
                this.Uid = (string)row["UID"];
            }
            else
            {
                this.Uid = string.Empty;
            }
            if (row["Client_ID"] != null && row["Client_ID"] != DBNull.Value)
            {
                this.ClientId = (string)row["Client_ID"];
            }
            else
            {
                this.ClientId = string.Empty;
            }
            if (row["Corp_Name"] != null && row["Corp_Name"] != DBNull.Value)
            {
                this.CorpName = (string)row["Corp_Name"];
            }
            else
            {
                this.CorpName = string.Empty;
            }
            if (row["Consigner"] != null && row["Consigner"] != DBNull.Value)
            {
                this.Consigner = (string)row["Consigner"];
            }
            else
            {
                this.Consigner = string.Empty;
            }
            if (row["Linkman"] != null && row["Linkman"] != DBNull.Value)
            {
                this.Linkman = (string)row["Linkman"];
            }
            else
            {
                this.Linkman = string.Empty;
            }
            if (row["Tel"] != null && row["Tel"] != DBNull.Value)
            {
                this.Tel = (string)row["Tel"];
            }
            else
            {
                this.Tel = string.Empty;
            }
            if (row["Phone"] != null && row["Phone"] != DBNull.Value)
            {
                this.Phone = (string)row["Phone"];
            }
            else
            {
                this.Phone = string.Empty;
            }
            if (row["Fax"] != null && row["Fax"] != DBNull.Value)
            {
                this.Fax = (string)row["Fax"];
            }
            else
            {
                this.Fax = string.Empty;
            }
            if (row["Addr"] != null && row["Addr"] != DBNull.Value)
            {
                this.Addr = (string)row["Addr"];
            }
            else
            {
                this.Addr = string.Empty;
            }
            if (row["Postcode"] != null && row["Postcode"] != DBNull.Value)
            {
                this.Postcode = (string)row["Postcode"];
            }
            else
            {
                this.Postcode = string.Empty;
            }
            if (row["email"] != null && row["email"] != DBNull.Value)
            {
                this.Email = (string)row["email"];
            }
            else
            {
                this.Email = string.Empty;
            }
            if (row["Charge"] != null && row["Charge"] != DBNull.Value)
            {
                this.Charge = (decimal)row["Charge"];
            }
            else
            {
                this.Charge = 0;
            }
            if (row["Report_Status"] != null && row["Report_Status"] != DBNull.Value)
            {
                this.ReportStatus = (int)row["Report_Status"];
            }
            else
            {
                this.ReportStatus = 0;
            }
            if (row["Report_URL"] != null && row["Report_URL"] != DBNull.Value)
            {
                this.ReportUrl = (string)row["Report_URL"];
            }
            else
            {
                this.ReportUrl = string.Empty;
            }
            if (row["Total_Price"] != null && row["Total_Price"] != DBNull.Value)
            {
                this.TotalPrice = (decimal)row["Total_Price"];
            }
            else
            {
                this.TotalPrice = 0;
            }
            if (row["Create_Time"] != null && row["Create_Time"] != DBNull.Value)
            {
                this.CreateTime = (DateTime)row["Create_Time"];
            }
            else
            {
                this.CreateTime = DateTime.MinValue;
            }
            if (row["Update_Time"] != null && row["Update_Time"] != DBNull.Value)
            {
                this.UpdateTime = (DateTime)row["Update_Time"];
            }
            else
            {
                this.UpdateTime = DateTime.MinValue;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Report_ID"] = this.ReportId;
            row["UID"] = this.Uid;
            row["Client_ID"] = this.ClientId;
            row["Corp_Name"] = this.CorpName;
            row["Consigner"] = this.Consigner;
            row["Linkman"] = this.Linkman;
            row["Tel"] = this.Tel;
            row["Phone"] = this.Phone;
            row["Fax"] = this.Fax;
            row["Addr"] = this.Addr;
            row["Postcode"] = this.Postcode;
            row["email"] = this.Email;
            row["Charge"] = this.Charge;
            row["Report_Status"] = this.ReportStatus;
            row["Report_URL"] = this.ReportUrl;
            row["Total_Price"] = this.TotalPrice;
            row["Create_Time"] = this.CreateTime;
            row["Update_Time"] = this.UpdateTime;
        }
        #endregion
    }
}
#endregion
